package amit.calc.form;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class TotalsPanel extends javax.swing.JPanel {
	private JLabel noLanel;
	private JTextField noTextField;
	private JTextField principal, interest, total;
	private JLabel balanceLabel;

	/**
	 * 
	 * @param principalVal
	 * @param interestVal
	 * @param totalVal
	 */
	public TotalsPanel(int noVal, double principalVal, double interestVal, double totalVal) {
		super();
		initGUI(noVal, principalVal, interestVal, totalVal);
	}

	private void initGUI(int noVal, double principalVal, double interestVal,
			double totalVal) {
			setLayout(new FlowLayout(FlowLayout.LEADING,5,5));
			setPreferredSize(new Dimension(500, 40));
			noLanel = new JLabel("No. of weeks:");
			add(noLanel);
			noTextField = new JTextField(""+noVal,5);
			noTextField.setBackground(Color.YELLOW);
			noTextField.setEditable(false);
			add(noTextField);
			balanceLabel = new JLabel("        Principal:");
			add(balanceLabel);
			principal = new JTextField(""+Math.round(principalVal),7);
			principal.setBackground(Color.YELLOW);
			principal.setEditable(false);
			add(principal);
			add(new JLabel("        Interest:"));
			interest = new JTextField(""+Math.round(interestVal),7);
			interest.setBackground(Color.RED);
			interest.setEditable(false);
			add(interest);
			add(new JLabel("        Total:"));
			total = new JTextField(""+Math.round(totalVal),7);
			total.setBackground(Color.YELLOW);
			total.setEditable(false);
			add(total);

	}

}
